/**
 * 
 */
package com.digitalart.futbol.hibernate.ejb;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonBackReference;
import org.codehaus.jackson.annotate.JsonManagedReference;

/**
 * @author Ulises & vandam
 * 
 */

@Entity
public class Cancha implements Serializable {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id_cancha;
	
	@Column
	private int hora_apertura;
	
	@Column
	private int hora_cierre;
	
	@Column
	private String foto;
	
	@Column
	private String nombre;
	
	@ManyToOne
	@JoinColumn(name="id_local")
	@JsonBackReference("canchas")
	private Local local;

	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="cancha")
	@JsonManagedReference("reservaciones")
	private List<Reservacion> reservaciones;
	
	@Column
	private boolean deleted;
	
	/**
	 * 
	 */

	public Cancha() {

	}

	/**
	 * @return the id
	 */
	public int getId_cancha() {
		return id_cancha;
	}

	/**
	 * @param id the id to set
	 */
	
	public void setId_cancha(int id_cancha) {
		this.id_cancha = id_cancha;
	}

	/**
	 * @return the hora_apertura
	 */
	public int getHora_apertura() {
		return hora_apertura;
	}

	/**
	 * @param hora_apertura the hora_apertura to set
	 */
	public void setHora_apertura(int hora_apertura) {
		this.hora_apertura = hora_apertura;
	}

	/**
	 * @return the hora_cierre
	 */
	
	public int getHora_cierre() {
		return hora_cierre;
	}

	/**
	 * @param hora_cierre the hora_cierre to set
	 */
	public void setHora_cierre(int hora_cierre) {
		this.hora_cierre = hora_cierre;
	}

	/**
	 * @return the foto
	 */
	
	public String getFoto() {
		return foto;
	}

	/**
	 * @param foto the foto to set
	 */
	public void setFoto(String foto) {
		this.foto = foto;
	}

	/**
	 * @return the local
	 */
	public Local getLocal() {
		return local;
	}

	/**
	 * @param local the local to set
	 */
	public void setLocal(Local local) {
		this.local = local;
	}

	public List<Reservacion> getReservaciones() {
		return reservaciones;
	}

	public void setReservaciones(List<Reservacion> reservaciones) {
		this.reservaciones = reservaciones;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	

}
